package org.hsc.proxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*
 * Commproj1_server.java
 *
 * Created on December 22, 2007
 *
 * Name:        Moty Michaely   |   Alon Halfon
 * ID:          043413087       |   300545969
 */

public class Commproj2_server {
	private static final Logger log=LoggerFactory.getLogger(Commproj2_server.class);
    /*
     * the main entry point
     * usage: outputUsage function
     * 
     */
    public static void main(String[] args) throws Exception {
            ProxyServerMediator serverMediator=null;
            try{
//                int port = Integer.parseInt(args[0]);
//                int cacheSize=Integer.parseInt(args[1]);
//                String outputFile=args[2];
//                int ttl=Integer.parseInt(args[2]);
                // Initiate the logger
//                Log.getInstance().setFileHandler(outputFile);
                // Start server mediator
            	log.info("starting server:"+8083);
                serverMediator=new ProxyServerMediator(8083, 1024, 1000);
                serverMediator.start();
            }
            catch(Exception e){
                System.out.println("Error starting server:" + e.getMessage());
            }
            finally {
                // Close the logger
//                Log.getInstance().closeLog();
                // Close the mediator
                if( serverMediator != null && serverMediator.getSocket() != null )
                    serverMediator.getSocket().close();
            }
    }
     
}
